-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for 'enum' tag to JSON schema generation #912
base: master
Are you sure you want to change the base?
Add support for 'enum' tag to JSON schema generation #912
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #912 +/- ##
==========================================
+ Coverage 98.46% 98.69% +0.23%
==========================================
Files 24 26 +2
Lines 1364 1761 +397
==========================================
+ Hits 1343 1738 +395
- Misses 15 16 +1
- Partials 6 7 +1 ☔ View full report in Codecov by Sentry. |
Hello, thank you for the PR! The PR description Could you please:
Thank you! |
Hi, thanks for checking my PR, I will implement what you say, although the tests for jsonschema are already broken. |
…d Comparasion test for manual created schema and struct-generated one | Also modify previous tests
Hey there! I’ve made some updates to the repository. Please take a look and let me know if you have any feedback. |
Hello, is there a straightforward way to set the enums using a variable? because struct tags must be literals, we cannot format them like this. |
I was able to do what I needed by editing the |
This pull request includes enhancements to the
jsonschema
package, specifically adding support for enumerations in schema definitions and improving the test coverage for schema generation and comparison.Enhancements to schema generation:
jsonschema/json.go
: Added support for parsingenum
tags in struct fields and including them in the generated schema. [1] [2]Improvements to test coverage:
jsonschema/json_test.go
: Added new tests to verify schema generation for types withenum
tags and to compare struct-generated schemas with manually created schemas.jsonschema/json_test.go
: Updated existing tests to remove unnecessaryproperties
fields from the expected JSON output. [1] [2] [3] [4] [5]